import { IPSAppDELogic } from '../../app/dataentity/ipsapp-delogic';
import { IPSAppDEMethod } from '../../app/dataentity/ipsapp-demethod';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSControlHandlerAction } from '../ipscontrol-handler-action';
import { IPSDEOPPriv } from '../../dataentity/priv/ipsdeoppriv';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSControlHandlerActionImpl extends PSModelObjectImpl implements IPSControlHandlerAction {
  protected adpsappdelogic: IPSAppDELogic | null = null;

  getADPSAppDELogic(): IPSAppDELogic | null {
    if (this.adpsappdelogic != null) return this.adpsappdelogic;
    const value = this.M.getADPSAppDELogic;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.adpsappdelogic = ipsappdataentity.findPSAppDELogic(value);
    }
    return this.adpsappdelogic;
  }

  get aDPSAppDELogic(): IPSAppDELogic | null {
    return this.getADPSAppDELogic();
  }

  getADPSAppDELogicMust(): IPSAppDELogic {
    const value = this.getADPSAppDELogic();
    if (value == null) {
      throw new Error('未指定上下文转换逻辑');
    }
    return value;
  }

  get actionDesc(): string {
    return this.M.actionDesc;
  }

  get actionName(): string {
    return this.M.actionName;
  }

  get actionType(): string {
    return this.M.actionType;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get customCond(): string {
    return this.M.customCond;
  }

  get dataAccessAction(): string {
    return this.M.dataAccessAction;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psappdemethod: IPSAppDEMethod | null = null;

  getPSAppDEMethod(): IPSAppDEMethod | null {
    if (this.psappdemethod != null) return this.psappdemethod;
    const value = this.M.getPSAppDEMethod;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdemethod = ipsappdataentity.findPSAppDEMethod(value);
    }
    return this.psappdemethod;
  }

  get psAppDEMethod(): IPSAppDEMethod | null {
    return this.getPSAppDEMethod();
  }

  getPSAppDEMethodMust(): IPSAppDEMethod {
    const value = this.getPSAppDEMethod();
    if (value == null) {
      throw new Error('未指定应用实体方法');
    }
    return value;
  }

  protected psappdataentity: IPSAppDataEntity | null = null;

  getPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.psappdataentity != null) return this.psappdataentity;
    const value = this.M.getPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.psappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getPSAppDataEntity') as IPSAppDataEntity;
    return this.psappdataentity;
  }

  get psAppDataEntity(): IPSAppDataEntity | null {
    return this.getPSAppDataEntity();
  }

  getPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定应用实体对象');
    }
    return value;
  }

  protected psdeoppriv: IPSDEOPPriv | null = null;

  getPSDEOPPriv(): IPSDEOPPriv | null {
    if (this.psdeoppriv != null) return this.psdeoppriv;
    const value = this.M.getPSDEOPPriv;
    if (value == null) {
      return null;
    }
    this.psdeoppriv = this.getPSModel4('dataentity.priv.IPSDEOPPriv', value, 'getPSDEOPPriv') as IPSDEOPPriv;
    return this.psdeoppriv;
  }

  get psDEOPPriv(): IPSDEOPPriv | null {
    return this.getPSDEOPPriv();
  }

  getPSDEOPPrivMust(): IPSDEOPPriv {
    const value = this.getPSDEOPPriv();
    if (value == null) {
      throw new Error('未指定实体操作标识对象');
    }
    return value;
  }

  get timeout(): number {
    return this.M.timeout != null ? this.M.timeout : -1;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSControlHandlerActionImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.IPSControlAction' || cls == 'control.IPSControlHandlerAction') return true;
    return super.instanceof(cls);
  }
}
